package com.hyy.backend.entity;

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

@Data
public class UserInfo implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    private int userId;

    @NotEmpty(message = "用户名不能为空")
    @Size(min = 3, max = 20, message = "用户名长度必须在3~20之间")
    private String userName;

    @Size(max = 50, message = "昵称不能超过50个字符")
    private String nickname;

    @Email(message = "邮箱格式错误")
    private String userEmail;

    @NotEmpty(message = "密码不能为空")
    private String password;

    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String userPhone;

    private int totalScore;
    private boolean active; // 用户状态：true为启用，false为禁用
    private UserType role; // 用户角色
    private String avatar; // 用户头像路径


    @Override
    public String toString() {
        return "UserInfo{" +
                "userId=" + userId +
                ", userName='" + userName + '\'' +
                ", nickname='" + nickname + '\'' +
                ", userEmail='" + userEmail + '\'' +
                ", password='" + password + '\'' +
                ", userPhone='" + userPhone + '\'' +
                ", totalScore=" + totalScore +
                ", active=" + active +
                ", role=" + role +
                ", avatar='" + avatar + '\'' +
                '}';
    }
}
